package restaurant;

import java.util.Date;

/**
 * The Command object to create a new offer.
 * 
 * @author Odessa
 */

public class cmdAddOffer implements Command
{

	/** The information aggregator. */
	private InformationAggregator info;

	/** The start date of the new offer. */
	private Date start;

	/** The end date of the new offer. */
	private Date end;

	/** The description of the new offer. */
	private String description;

	/** The discount provided by the new offer. */
	private double discount;



	/**
	 * Instantiates a new add offer command.
	 * 
	 * @param info the information aggregator.
	 * @param start the offer's start date.
	 * @param end the offer's end date.
	 * @param description the offer's description.
	 * @param discount the offer's discount.
	 */
	public cmdAddOffer(InformationAggregator info, Date start, Date end,
			String description, double discount) {
		this.info = info;
		this.start = start;
		this.end = end;
		this.description = description;
		this.discount = discount;
	}



	/**
	 * Creates a new offer.
	 * 
	 * @return the newly created offer.
	 * @see restaurant.Command#execute()
	 */
	@Override
	public Object execute()
	{
		SpecialOffers offers = info.getOffers();
		Offer newOffer = offers.createOffer(start, end, description, discount);

		return newOffer;
	}

}
